<?php

namespace app\admin\model;

use think\Model;

class Admin extends Model
{

    public function getUserByUserName($name)
    {
        return $this->where(['status' => 1, 'name' => $name])->find();
    }

	public function setErrorLogin($id , $oldNum){
		if($oldNum + 1 >= 3){
			$this->update(['id' => $id , 'err_num' => $oldNum + 1, 'err_expire_time' => NOW_TIME + 1800]);
		}else{
			$this->update(['id' => $id , 'err_num' => $oldNum + 1]);
		}
	}

}

